package com.xdb.sqlparser.dialect.mysql.ast;

import com.xdb.sqlparser.ast.SQLName;
import com.xdb.sqlparser.ast.statement.SQLTableConstraint;
import com.xdb.sqlparser.ast.statement.SQLUnique;
import com.xdb.sqlparser.ast.statement.SQLUniqueConstraint;
import com.xdb.sqlparser.dialect.mysql.visitor.MySqlASTVisitor;
import com.xdb.sqlparser.visitor.SQLAstVisitor;

public class MySqlKey extends SQLUnique implements SQLUniqueConstraint, SQLTableConstraint {

	private SQLName indexName;

	private String indexType;

	private boolean hasConstaint;

	public MySqlKey() {

	}

	@Override
	protected void accept0(SQLAstVisitor visitor) {
		if (visitor instanceof MySqlASTVisitor) {
			accept0((MySqlASTVisitor) visitor);
		}
	}

	protected void accept0(MySqlASTVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, this.getName());
			acceptChild(visitor, this.getColumns());
			acceptChild(visitor, indexName);
		}
		visitor.endVisit(this);
	}

	public String getIndexType() {
		return indexType;
	}

	public void setIndexType(String indexType) {
		this.indexType = indexType;
	}

	public SQLName getIndexName() {
		return indexName;
	}

	public void setIndexName(SQLName indexName) {
		this.indexName = indexName;
	}

	public boolean isHasConstaint() {
		return hasConstaint;
	}

	public void setHasConstaint(boolean hasConstaint) {
		this.hasConstaint = hasConstaint;
	}

}
